namespace two {
    export class EUIMC extends BaseGroup {
        private mc: one.DynamicFrames;

        protected created(): void {
            super.created();

            this.removeChildren();

            this.play();
        }

        public play(): void {
            if (this._frames == null || this._fileName == "") {
                return;
            }

            let mc = new one.DynamicFrames(this._frames, this._fileName, "jpg");
            mc.play("run", -1);
            mc.frameRate = this._frameRate;
            
            this.addChild(mc);

            mc.horizontalCenter = this._anchorX * 100;
            mc.verticalCenter = this._anchorY * 100;
        }

        private _anchorX : number = 0;
        public set anchorX(v : number ) {
            this._anchorX = v;
        }
        
        private _anchorY : number = 0;
        public set anchorY(v : number) {
            this._anchorY = v;
        }

        private _frames: { [label: string]: string[] } = null;
        // public get frames() : { [label: string]: string[] | number[] } {
        //     return this._frames;
        // }
        public set frames(v: string) {//1,2,4,5
            let f = v.split(",");
            this._frames = { "run": f };
        }

        private _fileName: string = "";
        // public get fileName() : string {
        //     return this._fileName;
        // }
        public set fileName(v: string) {
            this._fileName = v;
        }

        private _frameRate: number = 24;
        // public get frameRate(): number {
        //     return this._frameRate;
        // }
        public set frameRate(v: number) {
            this._frameRate = v;
        }
    }
}